<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
  <div id="app">
     <button @click="marry">marry</button>
  </div>
</body>
<script src="../js/vue.js"></script>
<script>
    Vue.config.productionTip = false;
    var vm = new Vue({
      el:"#app",
      data:{msg:"message from data"},
      methods:{
        marry(){
          //触发vue的自定义事件
          this.$emit("marry","早生贵子")
        }
      }
    })

    //注册vue的自定义事件!
    vm.$on("marry",(msg)=>{console.log("damu ❤ zdy",msg)})
    vm.$on("marry",(msg)=>{console.log("damu ❤ 迪丽热巴",msg)})
    vm.$on("marry",(msg)=>{console.log("damu ❤ 古力娜扎",msg)})

    // setTimeout(()=>{
    //   vm.$emit("marry")
    // },2000)
</script>
</html>